﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MetalSoda
{
    public interface IRouteNamingPolicy
    {
        string CreateName(DatabaseInfo farDatabase, Service farService);
    }

    class DefaultRouteNamingPolicy : IRouteNamingPolicy
    {
        public string CreateName(DatabaseInfo farDatabase, Service farService)
        {
            string serverInstanceName = farDatabase.Server.InstanceName.Equals("MSSQLSERVER", StringComparison.OrdinalIgnoreCase)
                ? string.Empty
                : string.Format(">{0}", farDatabase.Server.InstanceName);
            return string.Format("{0}{1}/{2}/{3}", 
                farDatabase.Server.ServerName, 
                serverInstanceName,
                farDatabase.DatabaseName,
                farService.Name);
        }
    }
}
